package com.platform.controller.backend;

import com.platform.base.BaseController;
import com.platform.common.Const;
import com.platform.common.ServerResponse;
import com.platform.pojo.UserRole;
import com.platform.service.IUserRoleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 用户角色控制层
 */
@RestController
@RequestMapping("/userRoleController/")
@CrossOrigin(origins = Const.REQUESTURL,maxAge = 3600,allowCredentials = "true")
public class UserRoleController extends BaseController {

    @Autowired
    private IUserRoleService iUserRoleService;

    @PostMapping(value = "add.do")
    public ServerResponse<String> insert(UserRole userRole){
        return iUserRoleService.insert(userRole);
    }

    @PostMapping(value = "del.do")
    public ServerResponse<String> del(Integer id){
        return iUserRoleService.del(id);
    }

    @GetMapping(value = "selectByUserName.do")
    public ServerResponse<List<String>> selectByUserName(String userName){
        return iUserRoleService.selectByUserName(userName);
    }
}
